/*
 * CommandDecorator.h
 *
 *  Created on: Nov 20, 2008
 *      Author: Ryan
 */

#ifndef COMMANDDECORATOR_H_
#define COMMANDDECORATOR_H_

#include "Command.h"
#include "../Units/Unit.h"

namespace OOInterface
{

/**
 * CommandDecorators are intended to augment existing Commands using the Decorator pattern.
 * All method calls can be forwarded to the decorated Command, or be changed/replaced if
 * so desired.
 */
class CommandDecorator: public OOInterface::Command
{
public:
	CommandDecorator( ConstCommandPtr decorated ) : _decorated( decorated ) {}
	virtual ~CommandDecorator() {}

	void setActor( ConstUnitPtr unit ) { CommandPtr ptr = boost::const_pointer_cast< Command > ( _decorated ); ptr->setActor( unit ); }
	ConstUnitPtr getActor() const { return _decorated->getActor(); }

	ConstCommandPtr getDecoratedCommand() const { return _decorated; }
private:
	ConstCommandPtr _decorated;
};

}

#endif /* COMMANDDECORATOR_H_ */
